<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.3.min.js"></script>
</head>
<body>
    <form>
        用户名: <input type="text" name="uname">
        密码: <input type="text" name="upwd">
        <input type="button" value="登录" onclick="loginFun()">
    </form>
</body>
</html>
<script>
    function loginFun() {
        $.post(
            "login",
            $("form").serialize(),
            function (obj) {
                if (Number(obj)){
                    alert("登录成功");
                    location.href = "food?m=findAll";
                } else {
                    alert("登录失败");
                }
            }
        );
    }
</script>